class AddRelationsInClient < ActiveRecord::Migration
  extend MigrationHelpers
  def self.up
    add_index(:clients, :county_id)
    add_index(:clients, :community_id)
    add_index(:clients, :clientstatus_id)
    add_index(:clients, :clientcategory_id)
    add_index(:clients, :foundmode_id)
    add_foreign_key(:clients, :county_id, :counties)
    add_foreign_key(:clients, :community_id, :communities)
    add_foreign_key(:clients, :clientstatus_id, :clientstatuses)
    add_foreign_key(:clients, :clientcategory_id, :clientcategories)
    add_foreign_key(:clients, :foundmode_id, :foundmodes)    
  end

  def self.down
    remove_foreign_key(:clients, :county_id)
    remove_foreign_key(:clients, :community_id)
    remove_foreign_key(:clients, :clientstatus_id)
    remove_foreign_key(:clients, :clientcategory_id)
    remove_foreign_key(:clients, :foundmode_id)
    remove_index(:clients, :county_id)
    remove_index(:clients, :community_id)
    remove_index(:clients, :clientstatus_id)
    remove_index(:clients, :clientcategory_id)
    remove_index(:clients, :foundmode_id)    
  end
end
